#include <iostream>
#include <string>
#include <functional>
#include "TcpServer.hpp"
#include "Http.hpp"
using namespace std;

void Usage(const string &proc)
{
    cout << "Usage:\n\t" << proc << " serverport" << endl;
}

//./httpserver 8888
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(0);
    }
    uint16_t port = stoi(argv[1]);

    HttpServer httpsvr;
    function<string(string)> service=std::bind(&HttpServer::HandlerHttpServer,&httpsvr,std::placeholders::_1);
    TcpServer tsvr(port,service);
    tsvr.Start();
    return 0;
}